<?php
$res=include_once './user.php';
include_once './config.php';
$data=$_POST;
$data['zc']=time();
    if ($data['usename'] == '' or $data['password'] == '') {
        reg("名字和密码不能为空", "index.php?reg=1.php", 3, "首页");
        return;
    }
    foreach ($res as $v) {
        if ($v['usename'] == $data['usename']) {
            reg("名字重复啦", "index.php?reg=1", 3, "首页");
            return;
        }
    }


    array_push($res, $data);

    $str = var_export($res, true);
//var_dump($str);exit();
    $res = "<?php return " . $str . "?>";
    file_put_contents("./user.php", $res);

    reg("注册成功啦", "index.php", 3, "首页");

    session_start();
    $_SESSION['usename']=$data['usename'];













?>